<?php if(!IS_AJAX){?><include file="Public:header" />



<div><div class="panel"><form action="{:U('index')}" id="masonryboxform" onSubmit="updatemasonry();" class="affixelement" style="z-index:100; background:#fff;padding:15px; margin-top:-5px;">


<div style="display:inline-block; vertical-align:middle;"><div class="input-group" style="width:250px;">
                                              
                                        <input name="keywords" type="text" class="form-control">
                                    <span class="input-group-btn">
                                                <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
                                              </span></div></div>
<a href="javascript:void(0);" class="btn btn-success" id="addpages">新建页面</a>  <a href="##" id="masonrybox1bob" class="btn btn-info">批量操作</a>



<div class="form-group pull-right" id="masonrybox1boc" style="display:none; padding-right:20px;"><a href="javascript:void(0);" class="btn btn-info" id="masonrybox1sa">全选</a>
                        <a href="javascript:void(0);" class="btn btn-info" id="masonrybox1ca">全不选</a>
                        <a href="javascript:void(0);" class="btn btn-info" id="masonrybox1sar">反选</a> <a rel="{:U('delete')}" href="##" class="btn btn-danger bdeleteBtn">删除选中</a> <a href="javascript:void(0);" class="btn btn-info" onClick="copyPages();">复制页面</a></div>


 
</form></div></div>

<div class="row" id="masonrybox1"></div>
<div class="row hidden" id="masonrybox">
<?php }?>
  <?php if(IS_AJAX){?>

  <volist name="list" id="vo">
    <div class="col-md-4 box" id="masonrybox-{$vo.id}">
      <div class="panel widget-info-one"  style="position:relative;">
      
      <div class="BatchOperation BatchOperationBtn">
                <input class="checkbox sall" type="checkbox" name="id[]" value="{$vo.id}">
                
                
                
                <i class="fa fa-check"></i>
                <div class="fabg"></div>
                
            </div>
      
      
        <div class="avatar-img"> <img src="{:getThumbPath($vo['img_url'])}" alt=""> </div>
        <div class="inner" style="padding:10px; height:auto; min-height:inherit;">
          <h5>{$vo.title}</h5>
        </div>
        
        
     <notempty name="relateSiteList"><volist name="relateSiteList" id="s">
     
     
     
     <div class="input-group m-bot15" style=" padding:0 10px;">
                                <span class="input-group-addon">{$s.title} </span>
                               <select onChange="setRelate(this.value);" class="form-control">
              
               
              
              <option value="0">请选择显示风格</option>
              <volist name="s['pageslist']" id="ps">
                            
                   <option <if condition="$ps['relate_id'] eq $vo['id']">selected="selected"</if> value="{$s.id}_{$ps.id}_{$vo.id}">{$ps.title}</option>
                      </volist>
              </select>
                            </div>
     
     
              
            
             </volist>
            </notempty>
         
 
        
        <div class="panel-footer">
          <ul class="post-view">
          
          
          
          
          
            <li onClick="_openWindow('<?php echo U('info', array('id' => $vo['id']));?>', 500, '修改页面信息', '保存', function(){ $('#masonryboxform').submit();}, '');">修改信息 </li>
            <li class="deleteBtn" rel="{:U('delete', array('id' => $vo['id']))}" data-id="{$vo.id}"> <a href="#"> <i class="fa fa-trash-o"></i> </a> 删除 </li>
            <li onClick="window.open('{:U('edit', array('id' => $vo['id']))}');" class="active"> <a href="##"> <i class="fa fa-edit"></i> </a> 布局 </li>
          </ul>
        </div>
        
        
        
        
        
        
        
        
        
        
      </div>
    </div>
  </volist>
<?php }?>
  <?php if(!IS_AJAX){?>
  
  

  
</div> 


 <div id="masonryboxpages" style="padding:50px; text-align:center;"></div>
<include file="Public:footer" /> 
<script src="__PUBLIC__/Js/jquery.masonry.min.js"></script>



<script type="text/javascript">


	
	
function updatemasonry(){
	if($('#masonrybox1').children().length > 0){
	$('#masonrybox1').masonry('destroy').empty();
	}
	$('#masonrybox1').masonry({
					itemSelector: '.box',
					columnWidth: 0,
					isAnimated : false
				});
}
updatemasonry();

	$('#masonrybox').ajaxlist({delcallback:function(c, id){
		$('#masonrybox1 #masonrybox-'+id).remove();
		updatemasonry();
	},append:true, BatchStartData:'#masonrybox1',
		success:function(obj){
			
			//$('#masonrybox').children().attr('id', '')
			var html = $('#masonrybox').children();
			//$('#masonrybox').html('<span></span>');
			//$('#masonrybox1')
			$newElems = html.appendTo('#masonrybox1');
			
			
			
			
			  $newElems.imagesLoaded(function(){
				  $('#masonrybox1').masonry( 'appended', $newElems, true);$(window).trigger('resize');
			  });
			
			
			

	
			
	    }
	});
	
	
	
	






function copyPages(){
		var ids=new Array();
		$('.sall').each(function(index, element) {
            if($(this).prop('checked')==true){
				ids.push($(this).val());
			}
        });
		if(ids.length>0){
			art.dialog.open('{:U('showcopybox')}?pages_id='+ids.toString(), {width: 400, height: 100,lock:true,title:'复制页面'});
			   
			
		}else{
			error('请选择要复制的页面');
		}
	}
	
	$('#addpages').click(function(e) {
        $.get('{:U('insert')}', {}, function(d){
			if(d.status == 1){
				$('#masonryboxform').submit();
				updatemasonry();
			}else{
				alert(d.info);
			}
		}, 'json');
    });
	
	
	
	function copyPages(){
		var ids=new Array();
		$('.sall').each(function(index, element) {
            if($(this).prop('checked')==true){
				ids.push($(this).val());
			}
        });
		if(ids.length>0){
			art.dialog.open('{:U('showcopybox')}?pages_id='+ids.toString(), {width: 400, height: 80,lock:true,title:'复制页面【选择目标站点】'});
			   
			
		}else{
			$.ThinkBox.error('请选择要复制的页面',{'delayClose':500,modal:false, 'close': '关闭',x:0,y:0,center:false,locate:['left','top'], show:['',0]});
			
		}
	}
	
	function setRelate(value){
		$.post('{:U('setRelate')}', {data:value}, function(ret){
			if(ret.status == 1){
				$.ThinkBox.success(ret.info,{'delayClose':500,modal:false, 'close': '关闭',x:0,y:0,center:false,locate:['left','top'], show:['',0]});
			}else{
				$.ThinkBox.error(ret.info,{'delayClose':500,modal:false, 'close': '关闭',x:0,y:0,center:false,locate:['left','top'], show:['',0]});
			}
		}, 'json');
	}
	

	
</script>
<style type="text/css">.box .widget-info-one{box-shadow:1px 1px 1px #ccc; border:1px solid #ccc; border-left-color:#e2e2e2; border-top-color:#e2e2e2; margin-bottom:15px; padding:3px;}
.wrapper{background:#fff;}
ul,li{list-style-type:none; margin:0; padding:0;}
	.fl{float:left;}
.fr{float:right;}
.qx_t1 { background:#EBEBEB; margin: 0px auto 15px; height: 32px; width: 593px; padding-left: 365px; font: 24px/28px "微软雅黑"; color: #333; }

.qx_list{ overflow:hidden; margin:0 auto}
.qx_list ul li { background: #FFF; padding:0; border: 1px solid #E5E5E5; float: left; width: 212px; margin: 0px 10px 10px 0px; }
.qx_list ul li img{width:100%; height:auto;}
.qx_picBox { border: 1px solid #E9E9E9; width: 210px; margin-bottom: 0; }
.qx_txt { font-size: 14px; line-height: 24px; }
.qx_txt p{margin-bottom: 8px; padding-left: 13px;}
</style>
</body></html>
<?php }?>